<script lang="ts" setup>
  import { translate } from '@/i18n'

  defineProps({
    itemOrMenu: {
      type: Object,
      default() {
        return null
      },
    },
  })
  const handleLink = () => {
    console.log('xx')
  }
</script>

<template>
  <el-sub-menu
    :index="itemOrMenu.path"
    popper-append-to-body
    @click="handleLink"
  >
    <template #title>
      <vab-icon
        v-if="itemOrMenu.meta.icon"
        :icon="itemOrMenu.meta.icon"
        :is-custom-svg="itemOrMenu.meta.isCustomSvg"
        :title="translate(itemOrMenu.meta.title)"
      />
      <span :title="translate(itemOrMenu.meta.title)">
        {{ translate(itemOrMenu.meta.title) }}
      </span>
    </template>
    <slot />
  </el-sub-menu>
</template>
